<template>
	<view>
		<uni-titles :title="title"></uni-titles>
		<uni-tudwhere></uni-tudwhere>
		<uni-grids :list="gridslist"></uni-grids>
		<uni-farmtitle :title="'我的农场'" :num="'58'" serchShow @isshow="show = !show"></uni-farmtitle>
		<uni-serchs v-if="show"></uni-serchs>
		<uni-menu :list="menulist" @mchange="mchange"></uni-menu>
		<template v-if="menuact == 0">
			<uni-farmlist2 :list="farmlist" @itemClick="itemClick" :rightText="'查看土地详情'" :rightTextColor="'#8DD16B'">
				<template #one="{}">
					<view class="btnbox mar-top20">
						<u-button text="待管理" @click="daiguanli" type="success" size="small"></u-button>
					</view>
				</template>
			</uni-farmlist2>
			<uni-more></uni-more>
		</template>
		<template v-else="menuact == 1">
			<uni-farmlist2 :list="farmlist" @itemClick="itemClick" :rightText="'查看土地详情'" :rightTextColor="'#8DD16B'">
				<template #one="{data}">

					<view class="Managed mar-top20">
						<view class="leftText fs-28">最近一次用肥用药({{data.time}})</view>
						<view class="rightContent" @click="gomanage(data)">
							<text class="fs-24">查看管理详情</text>
							<u-icon name="arrow-right" color="#8DD16B" size="14"></u-icon>
						</view>
					</view>
				</template>
			</uni-farmlist2>
			<uni-more></uni-more>
		</template>
	</view>
</template>

<script>
	export default {
		props:{
			title:{
				type:String,
				default:'种植管理'
			}
		},
		data() {
			return {
				show: false,
				gridslist: [{
										name: '画地块',
										id: 1,
										img: ''
									},
									{
										name: '种植管理',
										id: 2,
										img: ''
									},
									{
										name: '管地基',
										id: 3,
										img: ''
									},
									{
										name: '物联监测',
										id: 4,
										img: ''
									},
									{
										name: '环境气象',
										id: 5,
										img: ''
									},
									{
										name: '巡田地',
										id: 6,
										img: ''
									}
								],
				menulist: [{
					name: '待管理',
					num: 5
				}, {
					name: '已管理',
					num: 13
				}],
				menuact: 0,
				farmlist: [{
						name: '番茄',
						type: 5,
						zd: 5.2,
						day: 62,
						where: '荷花池小花园',
						time: '一周前',
						img: ''
					},
					{
						name: '西瓜',
						type: 3,
						zd: 18.1,
						day: 62,
						where: '天府广场小花园',
						time: '两天前',
						img: ''
					},
					{
						name: '番茄',
						type: 2,
						zd: 5,
						day: 62,
						where: '清水河小区',
						time: '三天前',
						img: ''
					}
				]
			};
		},
		methods: {
			mchange(index) {
				this.menuact = index;
			},
			itemClick(d) {

				uni.navigateTo({
					url: '/subpkg/zhgl/wherezhgl?title=' + d.name
				})
			},
			gomanage(d) {
				uni.navigateTo({
					url: '/subpkg/manageDetail/manageDetail?title=' + d.name
				})
			},
			daiguanli(d){
				uni.navigateTo({
					url: '/subpkg/zhgl/wherezhgl?title='
				})
			}
		}
	};
</script>

<style lang="scss">
	.btnbox {
		display: inline-block;
	// 	min-width: 150rpx;
	}

	.Managed {
		display: flex;
		justify-content: space-between;

		.leftText {
			color: #4BB0F7;
		}

		.rightContent {
			display: flex;
			align-items: center;
			color: #8DD16B;
		}
	}
</style>
